package cn.janus.controller;

import cn.janus.pojo.dto.BillInfoDTO;
import cn.janus.pojo.entity.Bill;
import cn.janus.pojo.vo.BillInfoVO;
import cn.janus.response.Result;
import cn.janus.service.IBillService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author janus
 * @since 2024-06-15
 */
@RestController
@RequestMapping("/bill")
@Api(tags = "账单")
public class BillController {
    @Resource
    private IBillService iBillService;

    @GetMapping("/info/")
    @ApiOperation(value = "分页账单")
    public Result billInfo(@Validated BillInfoDTO billInfoDTO) {
        BillInfoVO info = iBillService.billInfoService(billInfoDTO);
        return Result.ok(info);
    }
    @GetMapping("/update/")
    @ApiOperation(value = "更新账单")
    public Result billUpdate(Bill bill) {
        iBillService.UpdateBillById(bill);
        return Result.ok();
    }

}
